/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 98152
 * Date: 2024-10-14
 * Time: 19:44
 */
import java.util.Scanner;
import java.util.Stack;

// 注意类名必须为 Main, 不要有任何 package xxx 信息
public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        // 注意 hasNext 和 hasNextLine 的区别
        String str = in.nextLine();
        Stack<String> stack = new Stack<>();
        int len = str.length();
        for (int i = len - 1; i >= 0; i--) {
            String string = str.substring(i, i + 1);
            if (!stack.isEmpty()) {
                String stringP = stack.peek();
                if (string.equals(stringP)) {
                    stack.pop();
                } else {
                    stack.push(string);
                }
            }else {
                stack.push(string);
            }
        }
        if (stack.isEmpty()) {
            System.out.println(0);
        }
        while (!stack.isEmpty()) {
            System.out.print(stack.pop() + "");
        }
        System.out.println();
    }
    public static void main2(String[] args) {
        Scanner in = new Scanner(System.in);
        // 注意 hasNext 和 hasNextLine 的区别
        String str = in.nextLine();
        StringBuffer strbuffer = new StringBuffer(str);
        int i = 0;
        while (i < strbuffer.length() - 1) {
            char ch1 = strbuffer.charAt(i);
            char ch2 = strbuffer.charAt(i + 1);
            if (ch1 == ch2) {
                strbuffer.delete(i, i + 2);
                i = 0;
                continue;
            }
            i++;
        }
        if (strbuffer.length() == 0) {
            System.out.println(0);
        } else {
            System.out.println(strbuffer.toString());
        }
    }
    public static void main1(String[] args) {
        Scanner in = new Scanner(System.in);
        // 注意 hasNext 和 hasNextLine 的区别
        int a = in.nextInt();
        int b = in.nextInt();
        int count = 0;
        for(int i = a; i <= b; i++) {
            int j = i;
            while(j != 0) {
                if(j % 10 == 2) {
                    count++;
                }
                j /= 10;
            }
        }
        System.out.println(count);
    }
}
